<%@ page import="com.itheima.jspdemo.pojo.Brand" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%--
  Created by IntelliJ IDEA.
  User: ThinkPad
  Date: 2022/11/21
  Time: 10:39
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="新增"><br>
<hr>
<table border="1" cellspacing="0" width="800">
    <tr>
        <th>序号</th>
        <th>品牌名称</th>
        <th>企业名称</th>
        <th>排序</th>
        <th>品牌介绍</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    <%
        // 模拟从数据库提取了一些品牌列表
        // JSP 不建议写任何的业务逻辑 （连接数据库，取数据）
        List<Brand> listBrand  = new ArrayList();
        Brand b1 = new Brand();
        b1.setId(100);
        b1.setBrandName("松哥课堂");
        b1.setCompanyName("黑马程序员");
        b1.setOrdered(1000);
        b1.setDescription("大招课堂");
        b1.setStatus(1);
        Brand b2 = new Brand();
        b2.setId(200);
        b2.setBrandName("松哥课堂2");
        b2.setCompanyName("传智播客");
        b2.setOrdered(2000);
        b2.setDescription("大招课堂222");
        b2.setStatus(1);
        listBrand.add(b1);
        listBrand.add(b2);
        listBrand.add(new Brand(1,"三只松鼠","三只松鼠",100,"三只松鼠，好吃不上火",1));
        listBrand.add(new Brand(2,"优衣库","优衣库",200,"优衣库，服适人生",0));
        listBrand.add(new Brand(3,"小米","小米科技有限公司",1000,"为发烧而生",1));
        // 如果把集合的数据遍历到页面上呢
        // 一个tr是不是一条记录，所以，我们要，循环<tr>
    %>
    <%
        for(Brand brand:listBrand){
    %>
        <tr align="center">
            ${username}
                ${brand.id}
            <td><%=brand.getId()%></td>
            <td><%=brand.getBrandName()%></td>
            <td><%=brand.getCompanyName()%></td>
            <td><%=brand.getOrdered()%></td>
            <td><%=brand.getDescription()%></td>
            <td><%=(brand.getStatus()==1?"启用":"禁用")%></td>
            <td><a href="#">修改</a> <a href="#">删除</a></td>
        </tr>
    <%
        }
    %>
</table>

</body>
</html>
